package com.tiger.ebenv.sample1;

import java.rmi.RemoteException;

import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class EnvEntityTestBean implements SessionBean {

	private static final long serialVersionUID = 1L;

	private SessionContext sessionContext = null;

	public void ejbCreate() {

	}

	public String getString() {
		try {
			InitialContext ctx = new InitialContext();
			String stringEntry = (String) ctx.lookup("java:comp/env/StringEntry");
			return stringEntry;
		} catch (NamingException e) {
			throw new EJBException(e);
		}
	}

	public Character getCharacter() {
		try {
			InitialContext ctx = new InitialContext();
			Character characterEntry = (Character) ctx.lookup("java:comp/env/CharacterEntry");
			return characterEntry;
		} catch (NamingException e) {
			throw new EJBException(e);
		}
	}

	public Integer getInteger() {
		try {
			InitialContext ctx = new InitialContext();
			Integer integerEntry = (Integer) ctx.lookup("java:comp/env/IntegerEntry");
			return integerEntry;
		} catch (NamingException e) {
			throw new EJBException(e);
		}
	}

	public Boolean getBoolean() {
		try {
			InitialContext ctx = new InitialContext();
			Boolean booleanEntry = (Boolean) ctx.lookup("java:comp/env/BooleanEntry");
			return booleanEntry;
		} catch (NamingException e) {
			throw new EJBException(e);
		}
	}

	public Double getDouble() {
		try {
			InitialContext ctx = new InitialContext();
			Double doubleEntry = (Double) ctx.lookup("java:comp/env/DoubleEntry");
			return doubleEntry;
		} catch (NamingException e) {
			throw new EJBException(e);
		}
	}

	public Byte getByte() {
		try {
			InitialContext ctx = new InitialContext();
			Byte byteEntry = (Byte) ctx.lookup("java:comp/env/ByteEntry");
			return byteEntry;
		} catch (NamingException e) {
			throw new EJBException(e);
		}
	}

	public Short getShort() {
		try {
			InitialContext ctx = new InitialContext();
			Short shortEntry = (Short) ctx.lookup("java:comp/env/ShortEntry");
			return shortEntry;
		} catch (NamingException e) {
			throw new EJBException(e);
		}
	}

	public Long getLong() {
		try {
			InitialContext ctx = new InitialContext();
			Long longEntry = (Long) ctx.lookup("java:comp/env/LongEntry");
			return longEntry;
		} catch (NamingException e) {
			throw new EJBException(e);
		}
	}

	public Float getFloat() {
		try {
			InitialContext ctx = new InitialContext();
			Float floatEntry = (Float) ctx.lookup("java:comp/env/FloatEntry");
			return floatEntry;
		} catch (NamingException e) {
			throw new EJBException(e);
		}
	}

	public void ejbActivate() throws EJBException, RemoteException {
	}

	public void ejbPassivate() throws EJBException, RemoteException {
	}

	public void ejbRemove() throws EJBException, RemoteException {
	}

	public void setSessionContext(SessionContext sessionContext) throws EJBException, RemoteException {
		this.sessionContext = sessionContext;
	}
}
